home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_493 / amigalib / interface.doc < prev    next >
Text File  |  1992-05-06  |  15KB  |  369 lines

  1. This document describes the interface routines that I have written to permit
  2. AbSoft Fortran version 2.3 to interface properly with WorkBench and the ROM
  3. Kernel.
  4.  
  5. All these routines are built into the fortran library AMIGALIB.
  6.  
  7. Jim Locker
  8.  
  9.  
  10. Fortran callable subroutine              calls RKM Function
  11. -----------------------------------------------------------
  12.  
  13. Mov.sub                                   (graphics) Move
  14. Draw.sub                                  (graphics) Draw
  15. Fremem.sub                                (exec) FreeMem
  16. Curdir.sub                                (dos) CurrendDir
  17.  
  18. -----------------------------------------------------------
  19.  
  20. Other Interface Routines:
  21.  
  22. CreatePort -- create a standard system message port (in Fortran)
  23. DeletePort -- delete a standard system message port (in Fortran)
  24. Init.sc  -- Fortran startup module with workbench support. Source is WBINIT.ASM
  25. WBARGS.SUB  -- pulls first argument out of WBench startup message (in Fortran)
  26. WBEND.SUB -- handles WorkBench shutdown from Fortran (Assembler)
  27. WBSTAT.SUB -- tests if started from workbench (Assembler)
  28. WBSTRT.SUB -- returns address of workbench startup message (null if CLI)
  29.                (Assembler)
  30. STDOPN.SUB -- open a console window for Fortran modules (Assembler)
  31.  
  32. -----------------------------------------------------------
  33.  
  34. ARGUMENT LISTS:
  35.  
  36. C
  37. C                       CreatePort version 1.1
  38. C                         by Jim Locker
  39. C                       Published in Amazing Computing
  40. C
  41. C      This routine allocates memory and establishes a standard Amiga system
  42. C      Message Port for a Fortran program.
  43. C
  44. C
  45. C      INPUTS:
  46. C              pname;  A pointer to a null terminated string that contains
  47. C                      the name of the Message Port.  May be a null string
  48. C
  49. C              pri;    The priority of the message port
  50. C
  51. C              taskid; The name of the Fortran process that creates the port
  52. C
  53. C      RETURNS:
  54. C
  55. C              mp;     The return variable that contains the pointer to the
  56. C                      Message Port
  57. C
  58. C
  59. C      USAGE:
  60. C
  61. C                integer*4 pri,mp,taskid
  62. C                character*32 pname
  63. C
  64. C                pname = 'myname'\\CHAR(0)
  65. C
  66. C                call CreatePort(pname,pri,mp,taskid)
  67. C
  68. C     When CreatePort returns, you should check mp to ensure that it is
  69. C     not null.  If it is null, the allocation failed and you should react
  70. C     accordingly.
  71. C
  72. **************************************************************************
  73. *
  74. *                  CURDIR  by Jim Locker, SofTech Inc.
  75. *                          17 January, 1990
  76. *
  77. *                  called from AbSoft Fortran
  78. *                  calls system CurrentDir routine
  79. *                  Needed because Amiga.sub does it wrong.
  80. *
  81. *                  USAGE:
  82. *
  83. *                    OldDir = CURDIR(LOCK)
  84. *
  85. *                    where LOCK is a directory lock
  86. *
  87. ***************************************************************************
  88. C          DeletePort
  89. C          by Jim Locker
  90. C          Published in Amazing Computing
  91. C
  92. C    DeletePort deletes a port that was created by CreatePort from within
  93. C    a Fortran process.
  94. C
  95. C          INPUTS:
  96. C                 port: the pointer to the message port that was returned 
  97. C                       by CreatePort
  98. C
  99. C          OUTPUTS:  None
  100. C
  101. C          USAGE:
  102. C                Integer*4 port
  103. C
  104. C                Call DeletePort(port)
  105. C
  106. C
  107. **************************************************************************
  108. *
  109. *                  DRAW  by Jim Locker, SofTech Inc.
  110. *                          19 June, 1989
  111. *
  112. *                  called from AbSoft Fortran
  113. *                  calls system DRAW routine
  114. *                  Needed because Amiga.sub is too slow.
  115. *
  116. *                  USAGE:
  117. *
  118. *                    Call DRAW(GFXBASE,RastPort,X,Y)
  119. *
  120. ***************************************************************************
  121. **************************************************************************
  122. *
  123. *                  FREMEM  by Jim Locker, SofTech Inc.
  124. *                          13 April, 1989
  125. *
  126. *                  called from AbSoft Fortran
  127. *                  calls system FREEMEM routine
  128. *                  Needed because Amiga.sub does it wrong.
  129. *
  130. *                  USAGE:
  131. *
  132. *                    Call Fremem(MEMBLOCK,MEMSIZE)
  133. *
  134. ***************************************************************************
  135. **************************************************************************
  136. *
  137. *                  MOV  by Jim Locker, SofTech Inc.
  138. *                          19 June, 1989
  139. *
  140. *                  called from AbSoft Fortran
  141. *                  calls system MOVE routine
  142. *                  Needed because Amiga.sub is too slow.
  143. *
  144. *                  USAGE:
  145. *
  146. *                    Call MOV(GFXBASE,RastPort,X,Y)
  147. *
  148. ***************************************************************************
  149. **********************************************************************
  150. *
  151. *   STDOPN version 1.1
  152. *
  153. *   Open a console device and attach it as the standard I/O channel for
  154. *   Fortran.  For use with Amiga AbSoft Fortran v 2.3, the Fortran 
  155. *   startup module WBINIT.ASM, and the Fortran-Workbench shutdown module
  156. *   WBEND.ASM (WBEND.SUB).  Compatible with normal CLI startup, but does
  157. *   not open a separate window when run from CLI.
  158. *
  159. *   Author:  Jim Locker, SofTech Inc.  Published in Amazing Computing.
  160. *
  161. *   This program is placed in the public domain.  Use as you see fit, but
  162. *   the author accepts no liability for anything.
  163. *
  164. *   Usage:
  165. *
  166. *          CALL STDOPN('CON:Lside/Top/Rside/Bot/my window name')
  167. *          where Lside is the pixel location of the left hand side of 
  168. *          the window, Top is the pixel location of the top, Rside
  169. *          is the width of the window, Bot is the height of the window,
  170. *          and "my window name" is self explanatory.  Be careful not to set
  171. *          the size of the window larger than the screen...the Guru will
  172. *          come calling
  173. *
  174. *          This call should precede any attempts to access the standard 
  175. *          Fortran console device from within your Fortran program.
  176. *
  177. *   This routine should be present if a Fortran program is to be started
  178. *   from Workbench.  A bug in Workbench prevents the ToolWindow in the icon
  179. *   from being passed to the application.  As a result, the WBINIT.ASM 
  180. *   startup code will not open a default window for a program started from
  181. *   Workbench.  Such a window is not always needed, but if it is, use this
  182. *   function.
  183. *
  184. *   As an unexpected benefit, this program will enable you to close the 
  185. *   default window that you started with and open a new one.  I am not sure
  186. *   why you would want to do this, but the possibility is there.
  187. *
  188. *    CHANGE HISTORY
  189. *     8 June 1989    Added capability to accept arguments in call
  190. *
  191. *****************************************************************************
  192. C
  193. C                    WBArgs.FOR
  194. C                    by Jim Locker, SofTech Inc.
  195. C                    Oct 89
  196. C
  197. C                    version 1.2
  198. C
  199. C        This routine needs WBInit.asm to run correctly.  It accepts
  200. C        the address of a WorkBench startup message as input, then tests
  201. C        to see whether any arguments were passed to the Fortran program
  202. C        by examining the message.  If any arguments were passed (should
  203. C        be a file name), WBArgs will copy the string found in the ArgList
  204. C        into a character buffer.  This version of the program will only
  205. C        find and copy one string.  Given the way Fortran works, it seems
  206. C        unlikely that more than one string needs to be copied.
  207. C
  208. C
  209. C                     INPUTS:
  210. C
  211. C                         STARTUP.  A pointer to a workbench startup message
  212. C                                   as returned by WBSTRT
  213. C
  214. C                     OUTPUTS:
  215. C
  216. C                         FILNAM.  A 32 byte character array containing a 
  217. C                                  null terminated string that is what was
  218. C                                  found in the ArgList.
  219. C
  220. C                         OLDDIR.  A file lock on the directory that was the
  221. C                                  current directory when we entered this
  222. C                                  routine.  You need to CURDIR(OLDDIR) before
  223. C                                  exiting, if there was a FILNAM passed in by
  224. C                                  Workbench.
  225. C                     USAGE:
  226. C
  227. C                         INTEGER*4 WBSTRT,STARTUP,OLDDIR
  228. C                         CHARACTER*1 FILNAM(32)
  229. C
  230. C                         STARTUP = WBSTRT(0)
  231. C                         IF(STARTUP .NE. 0) CALL WBARGS(STARTUP,FILNAM,OLDDIR)
  232. C
  233. C        When WBArgs returns, you should test the first element of FILNAM
  234. C        to determine whether or not there was an argument in the startup
  235. C        message.  The first element of FILNAM will be CHAR(0) if there was
  236. C        no argument.
  237. C
  238. C        CHANGE HISTORY
  239. C
  240. C        17 Jan 1990 Modified to use assembly routine CURDIR instead of
  241. C                    using amiga.sub to call CurrentDir...Amiga.sub did not
  242. C                    call CurrentDir correctly.
  243. C        7 Feb 1990  Modified to return Old directory Lock.  We need it 
  244. C                    later, when we exit from program in order to eliminate
  245. C                    dangling locks.
  246. ************************************************************************
  247. *
  248. *   WBEND   version 1.0
  249. *
  250. *
  251. *  Perform all necessary operations to shut down a Fortran program which
  252. *  was started from Workbench.  For use with Amiga AbSoft Fortran v 2.3,
  253. *  the module STDOPEN.ASM, and the Fortran-Workbench startup module
  254. *  WBINIT.ASM (INIT.SC).  Compatible with normal CLI startup.
  255. *
  256. *  Author:  Jim Locker, SofTech Inc.  Published in Amazing Computing
  257. *
  258. *  This program is placed in the public domain, but the Author accepts no
  259. *  responsibility whatsoever for anything that anyone does with it.
  260. *
  261. *  USAGE:
  262. *
  263. *      CALL WBEND
  264. *
  265. *        This call must be the last statement in the program, except for the
  266. *        normal END statement.  If you call this from anywhere else in the 
  267. *        program, you will crash.
  268. *
  269. *  This program must be linked into your executable using F77L.  It will 
  270. *  crash if run unlinked.
  271. *
  272. *************************************************************************
  273. *************************************************************************
  274. *              WBInit.asm---FORTRAN Compiler Startup Code               *
  275. *                    Substantially based upon                           *
  276. *                                the                                    *
  277. *               ABSOFT CORPORATION FORTRAN 77 COMPILER                  *
  278. *                                                                       *
  279. *                       MAIN PROGRAM START UP CODE                      *
  280. *                               FOR                                     *
  281. *                       AMIGADOS BASED SYSTEMS                          *
  282. *                                                                       *
  283. *                       Copyright (C) 1986,1987                         *
  284. *               Absoft Corporation, Royal Oak, MI  48072                *
  285. *                                                                       *
  286. *                                                                       *
  287. *       This code segment is the main program start up procedure, with  *
  288. *       workbench support.   It must be linked using Alink or Blink to  *
  289. *       amiga.lib.                                                      *
  290. *                                                                       *
  291. *       The resulting linker output file must be named "init.sc".       *
  292. *                                                                       *
  293. *       The file is also used in source form as an INCLUDE file when    *
  294. *       assembly language source is being generated by the compiler     *
  295. *       for a main program.                                             *
  296. *                                                                       *
  297. *       The routine performs the following functions:                   *
  298. *                                                                       *
  299. *               1. Test for workbench vs CLI startup                    *
  300. *               2. If workbench, handle all necessary environment issues*
  301. *               3. allocate a memory segment for the heap               *
  302. *               4. open "dos.library"                                   *
  303. *               5. locate the STDIN and STDOUT file handles             *
  304. *               6. load f77.rl into the heap                            *
  305. *                                                                       *
  306. *       The routine passes the following registers to f77.rl:           *
  307. *                                                                       *
  308. *               D2 - run-time library specification:                    *
  309. *                    0 = f77.rl                                         *
  310. *                    1 = hdw.rl (not available for Amiga)               *
  311. *                    2 = m81.rl                                         *
  312. *               D5 - command line length                                *
  313. *               A0 - pointer to heap                                    *
  314. *               A2 - pointer to main program                            *
  315. *               A3 - command line pointer                               *
  316. *               A4 - debug or profil command line pointer               *
  317. *               A5 - pointer to f77.rl                                  *
  318. *                                                                       *
  319. *                                                                       *
  320. *************************************************************************
  321. *
  322. * Edit history:
  323. *
  324. *  19 Feb 86    file created                                            PAJ
  325. *  02 Jun 87    converted to V2.3                                       CAG
  326. *  06 Mar 89    WorkBench support provided         Jim Locker
  327. *************************************************************************
  328. **********************************************************************
  329. *
  330. *   WBStat version 1.0
  331. *
  332. *   Let a Fortran application determine whether or not it started from
  333. *   WorkBench 
  334. *
  335. *   Author:  Jim Locker, SofTech Inc.  
  336. *
  337. *   This program is placed in the public domain.  Use as you see fit, but
  338. *   the author accepts no liability for anything.
  339. *
  340. *   Usage:
  341. *
  342. *          INTEGER*4 Message
  343. *          Message = WBStat(0)
  344. *
  345. *
  346. *****************************************************************************
  347. **********************************************************************
  348. *
  349. *   WBStrt version 1.1
  350. *
  351. *   Bring the location of a Workbench startup message into a Fortran 
  352. *   application
  353. *
  354. *   Author:  Jim Locker, SofTech Inc.  Published in Amazing Computing.
  355. *
  356. *   This program is placed in the public domain.  Use as you see fit, but
  357. *   the author accepts no liability for anything.
  358. *
  359. *   Usage:
  360. *
  361. *          INTEGER*4 Message
  362. *          Message = CALL WBStrt
  363. *
  364. *   Change history:
  365. *
  366. *    14 June 1989  Modified to return a 0 if not started from workbench
  367. *
  368. *****************************************************************************
  369.